/**
 * 
 */
package com.unicomcz.test;

import java.io.File;

import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

/**
 * @author Administrator
 *
 */
public class testXLS {
	
	public void replux(String source,String dest){
		Workbook wb = null;
		WritableWorkbook wwb = null;
		try{
			wb = Workbook.getWorkbook(new File(source));
			wwb = Workbook.createWorkbook(new File(dest),wb);
			//Sheet sh = wb.getSheet(0);
			WritableSheet ws=wwb.getSheet(0);
			for (int i=0 ;i<ws.getRows();i++){
				for (int j=0;j<ws.getColumns();j++){
					if (ws.getCell(j, i).getContents().compareTo("${823(1,9)}")==0){
						System.out.print(i);
						System.out.print(",");
						System.out.print(j);
						System.out.print(":");
						System.out.println(ws.getCell(j, i).getContents());
						//ws.getCell(j, i).getCellFormat()
						jxl.write.WritableCellFormat wcfFC = new WritableCellFormat(); 
						System.out.print(i);
						System.out.print(",");
						System.out.print(j);
						System.out.print(":");
						System.out.println(ws.getCell(j, i).getContents());
						ws.addCell(new Label(j,i,"6",wcfFC));
					}

				}
			}
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try{
				wwb.write();
				wwb.close();
			}catch(Exception e){
				
			}
			try{
				wb.close();
			}catch(Exception e){
				
			}
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		testXLS t = new testXLS();
		t.replux("c:\\test1.xls", "c:\\test12.xls");

	}

}
